/*
 *Copyright (c) 2024 Black Sesame Technologies
 *
 *Licensed under the Apache License, Version 2.0 (the "License");
 *you may not use this file except in compliance with the License.
 *You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 *Unless required by applicable law or agreed to in writing, software
 *distributed under the License is distributed on an "AS IS" BASIS,
 *WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *See the License for the specific language governing permissions and
 *limitations under the License.
*/

#include "types.h"

#define GMAC_SW_GMAC_INTERNAL		(0x217B8000)
#define GMAC_MAC_TIMESTAMP_CTRL		(0xb00)
#define GMAC_MAC_SYS_TIME_SEC		(0xb08)
#define GMAC_MAC_SYS_TIME_NANOSEC	(0xb0c)

#define BIT(x)  (1UL << (x))
#define REG32_READ(__addr)				(*(volatile u32 *)(__addr))
#define REG32_WRITE(__addr,__val)		{(*(volatile u32 *)(__addr) = (__val));asm("DSB");}

struct timespec64 {
    u32 tv_sec;
	u32 tv_nsec;
};

int gmac_get_phc_time(struct timespec64 *systime);